package com.gzx.plugin.tjzy.modular.call.receipt.controller;

import com.gzx.plugin.tjzy.modular.call.receipt.service.GzxHtCallReceiptService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import vip.xiaonuo.common.pojo.CommonResult;

/**
 * @author zjt
 * @description
 * @date 2024/12/4 17:42
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/tjzy/call")
public class GzxHtCallReceiptController {

    private final GzxHtCallReceiptService htCallReceiptService;

    /**
     * 话单记录
     *
     * @param multipartFile
     */
    @PostMapping("/receive/sendReceiptToKafka")
    public void sendReceiptToKafka(@RequestParam("multipartFile") MultipartFile multipartFile) {
        htCallReceiptService.sendReceiptToKafka(multipartFile);
    }

    /**
     * 话单记录
     *
     * @param callRecordStr
     */
    @PostMapping("/receive/receipt")
    public void receiveCallReceipt(@RequestBody String callRecordStr) {
        htCallReceiptService.receiveCallReceipt(callRecordStr);
    }

    /**
     * 发送消息
     *
     * @return
     */
    @PostMapping("/receive/voice-to-text")
    public CommonResult<Void> receiveVoiceText(@RequestBody String reqBody) {
        htCallReceiptService.receiveVoiceText(reqBody);
        return CommonResult.ok();
    }


    @GetMapping("/receive/setFmPhone")
    public void setFmPhone(@RequestParam("fmPhone") String fmPhone) {
        htCallReceiptService.setFmPhone(fmPhone);
    }
}
